# This code is hosted on http://code.google.com/p/lenthorp/
# Freely available for use in applications, but should NOT be modified
# Email all comments to lenthorpresearch@gmail.com

def solveTridiagonal(a, b, c, v):
    # a = sub-diagonal
    # c = sup-diagonal

    size = len(a)
    x = [0.0 for idx in range(size)]

    for idx in range(1,size):
        m = b[idx] - c[idx-1] * a[idx]
        c[idx] -= m*c[idx-1]
        v[idx] -= m*v[idx-1]

    x[size-1] = v[size-1] / b[size-1]

    for idx in range(size-2, -1, -1):
        x[idx] = (v[idx] - c[idx] * x[idx+1]) / b[idx]

def solveGaussSiedel(mat, v):
    # we must have len(mat) == len(v)
    return 0